home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 December / maximum-cd-2009-12.iso / DiscContents / gimp-2.7.0-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / tileblur.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2009-08-19  |  2.7 KB  |  80 lines

  1. ; Chris Gutteridge (cjg@ecs.soton.ac.uk)
  2. ; At ECS Dept, University of Southampton, England.
  3.  
  4. ; This program is free software: you can redistribute it and/or modify
  5. ; it under the terms of the GNU General Public License as published by
  6. ; the Free Software Foundation; either version 3 of the License, or
  7. ; (at your option) any later version.
  8. ;
  9. ; This program is distributed in the hope that it will be useful,
  10. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. ; GNU General Public License for more details.
  13. ;
  14. ; You should have received a copy of the GNU General Public License
  15. ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16.  
  17.  
  18. (define (script-fu-tile-blur inImage inLayer inRadius inVert inHoriz inType)
  19.  
  20.   (let* (
  21.         (theImage inImage)
  22.         (theLayer inLayer)
  23.         (theHeight (car (gimp-drawable-height theLayer)))
  24.         (theWidth (car (gimp-drawable-width theLayer)))
  25.         )
  26.  
  27.     (define (pasteat xoff yoff)
  28.       (let ((theFloat (car(gimp-edit-paste theLayer 0))))
  29.         (gimp-layer-set-offsets theFloat (* xoff theWidth) (* yoff theHeight) )
  30.         (gimp-floating-sel-anchor theFloat)
  31.        )
  32.     )
  33.  
  34.     (gimp-image-undo-group-start theImage)
  35.     (gimp-layer-resize theLayer (* 3 theWidth) (* 3 theHeight) 0 0)
  36.  
  37.     (gimp-rect-select theImage 0 0 theWidth theHeight CHANNEL-OP-REPLACE 0 0)
  38.     (gimp-edit-cut theLayer)
  39.  
  40.     (gimp-selection-none theImage)
  41.     (gimp-layer-set-offsets theLayer theWidth theHeight)
  42.  
  43.     (pasteat 1 1) (pasteat 1 2) (pasteat 1 3)
  44.     (pasteat 2 1) (pasteat 2 2) (pasteat 2 3)
  45.     (pasteat 3 1) (pasteat 3 2) (pasteat 3 3)
  46.  
  47.     (gimp-selection-none theImage)
  48.     (if (= inType 0)
  49.         (plug-in-gauss-iir RUN-NONINTERACTIVE
  50.                theImage theLayer inRadius inHoriz inVert)
  51.         (plug-in-gauss-rle RUN-NONINTERACTIVE
  52.                theImage theLayer inRadius inHoriz inVert)
  53.     )
  54.  
  55.     (gimp-layer-resize theLayer
  56.                        theWidth theHeight (- 0 theWidth) (- 0 theHeight))
  57.     (gimp-layer-set-offsets theLayer 0 0)
  58.     (gimp-image-undo-group-end theImage)
  59.     (gimp-displays-flush)
  60.   )
  61. )
  62.  
  63. (script-fu-register "script-fu-tile-blur"
  64.   _"_Tileable Blur..."
  65.   _"Blur the edges of an image so the result tiles seamlessly"
  66.   "Chris Gutteridge"
  67.   "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
  68.   "25th April 1998"
  69.   "RGB*"
  70.   SF-IMAGE       "The Image"         0
  71.   SF-DRAWABLE    "The Layer"         0
  72.   SF-ADJUSTMENT _"Radius"            '(5 0 128 1 1 0 0)
  73.   SF-TOGGLE     _"Blur vertically"   TRUE
  74.   SF-TOGGLE     _"Blur horizontally" TRUE
  75.   SF-OPTION     _"Blur type"         '(_"IIR" _"RLE")
  76. )
  77.  
  78. (script-fu-menu-register "script-fu-tile-blur"
  79.                          "<Image>/Filters/Blur")
  80.